'use strict';
const bcrypt = require('bcryptjs');

/** @type {import('sequelize-cli').Migration} */
module.exports = {
    async up(queryInterface, Sequelize) {
        await queryInterface.bulkInsert('Users', [
            {
                email: 'admin@localhost',
                username: 'admin',
                password: bcrypt.hashSync('044869',10),
                nickname: '超级管理员',
                sex: 1,
                role: 100,
                createdAt: new Date(),
                updatedAt: new Date()
            },
            {
                email: 'user1@163.com',
                username: 'user1',
                password: bcrypt.hashSync('123456',10),
                nickname: '普通用户1',
                sex: 0,
                role: 0,
                createdAt: new Date(),
                updatedAt: new Date()
            },
            {
                email: 'user2@163.com',
                username: 'user2',
                password: bcrypt.hashSync('123456',10),
                nickname: '普通用户2',
                sex: 1,
                role: 0,
                createdAt: new Date(),
                updatedAt: new Date()
            },
            {
                email: 'user3@163.com',
                username: 'user3',
                password: bcrypt.hashSync('123456',10),
                nickname: '普通用户3',
                sex: 0,
                role: 0,
                createdAt: new Date(),
                updatedAt: new Date()
            },
            {
                email: 'user4@163.com',
                username: 'user4',
                password: bcrypt.hashSync('123456',10),
                nickname: '普通用户4',
                sex: 1,
                role: 0,
                createdAt: new Date(),
                updatedAt: new Date()
            },

        ], {});
    },

    async down(queryInterface, Sequelize) {
        await queryInterface.bulkDelete('Users', null, {});
    }
};
